package ssx.demo.ssxutils.learn2;

import java.util.concurrent.locks.ReentrantLock;

public class Main {
    public static  int count = 0;

    public static void main(String[] args) {
        ReentrantLock reentrantLock = new ReentrantLock();
        Product product = new Product();
        Consumer consumer = new Consumer();

        Runnable runnable1 = ()->{
            for (int i = 0; i < 100; i++) {
                product.add(reentrantLock);
            }
        };
        Runnable runnable2 = ()->{
            for (int i = 0; i < 100; i++) {
                consumer.del(reentrantLock);
            }
        };

        new Thread(runnable1).start();
        new Thread(runnable2).start();

    }
}
